<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GrPPI: context.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.svg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">GrPPI
   &#160;<span id="projectnumber">0.3.1</span>
   </div>
   <div id="projectbrief">Generic and Reusable Parallel Pattern Interface</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_0966d06610f72609fd9aa4979c2b5a92.html">common</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">common/context.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="common_2context_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#ifndef GRPPI_COMMON_CONTEXT_H</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#define GRPPI_COMMON_CONTEXT_H</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#include &lt;type_traits&gt;</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacegrppi.html">grppi</a> {</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> ExecutionPolicy, <span class="keyword">typename</span> Transformer&gt;</div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="classgrppi_1_1context__t.html">   36</a></span>&#160;<span class="keyword">class </span><a class="code" href="classgrppi_1_1context__t.html">context_t</a> {</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="classgrppi_1_1context__t.html#a1f38ffef80227917ab625a611556aaee">   39</a></span>&#160;  <span class="keyword">using</span> <a class="code" href="classgrppi_1_1context__t.html#a1f38ffef80227917ab625a611556aaee">transformer_type</a> = Transformer;</div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="classgrppi_1_1context__t.html#a12e3b41587de007b173d04fcf12529e6">   40</a></span>&#160;  <span class="keyword">using</span> <a class="code" href="classgrppi_1_1context__t.html#a12e3b41587de007b173d04fcf12529e6">execution_policy_type</a> = ExecutionPolicy;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="classgrppi_1_1context__t.html#a370f6d677c82a8088310bbf9eff654ab">   47</a></span>&#160;  <a class="code" href="classgrppi_1_1context__t.html#a370f6d677c82a8088310bbf9eff654ab">context_t</a>(ExecutionPolicy &amp; e, Transformer &amp;&amp; t) noexcept :</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    execution_policy_{e}, transformer_{t}</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;  {}</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="classgrppi_1_1context__t.html#ac0731f745c4692b220cd717653f9f38e">   55</a></span>&#160;  ExecutionPolicy &amp; <a class="code" href="classgrppi_1_1context__t.html#ac0731f745c4692b220cd717653f9f38e">execution_policy</a>(){</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    <span class="keywordflow">return</span> execution_policy_;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;  }</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;  </div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="classgrppi_1_1context__t.html#ad53477882ee86ffd96faa2b3c2a91407">   64</a></span>&#160;  Transformer &amp; <a class="code" href="classgrppi_1_1context__t.html#ad53477882ee86ffd96faa2b3c2a91407">transformer</a>(){</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <span class="keywordflow">return</span> transformer_;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;  }</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> I&gt;</div><div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="classgrppi_1_1context__t.html#a90fc787409776bca4dffcbf7cf660626">   72</a></span>&#160;  <span class="keyword">auto</span> <a class="code" href="classgrppi_1_1context__t.html#a90fc787409776bca4dffcbf7cf660626">operator()</a>(I &amp;&amp; item)<span class="keyword"> const </span>{</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <span class="keywordflow">return</span> transformer_(std::forward&lt;I&gt;(item));</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;  }</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;  Transformer transformer_;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;  ExecutionPolicy&amp; execution_policy_;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;};</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="keyword">namespace </span>internal {</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div><div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="structgrppi_1_1internal_1_1is__context.html">   84</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structgrppi_1_1internal_1_1is__context.html">is_context</a> : std::false_type {};</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> E, <span class="keyword">typename</span> T&gt;</div><div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="structgrppi_1_1internal_1_1is__context_3_01context__t_3_01_e_00_01_t_01_4_01_4.html">   87</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structgrppi_1_1internal_1_1is__context.html">is_context</a>&lt;<a class="code" href="classgrppi_1_1context__t.html">context_t</a>&lt;E,T&gt;&gt; : std::true_type {};</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;} <span class="comment">// namespace internal</span></div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div><div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="namespacegrppi.html#ad3e99e81ed819576b5ee62e71144b77c">   92</a></span>&#160;<span class="keyword">static</span> constexpr <span class="keywordtype">bool</span> <a class="code" href="namespacegrppi.html#ad3e99e81ed819576b5ee62e71144b77c">is_context</a> = <a class="code" href="structgrppi_1_1internal_1_1is__context.html">internal::is_context&lt;std::decay_t&lt;T&gt;</a>&gt;();</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div><div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="namespacegrppi.html#ad4b58959f8008485515060fe1a37fb21">   95</a></span>&#160;<span class="keyword">using</span> <a class="code" href="namespacegrppi.html#ad4b58959f8008485515060fe1a37fb21">requires_context</a> = <span class="keyword">typename</span> std::enable_if_t&lt;is_context&lt;T&gt;, <span class="keywordtype">int</span>&gt;;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;}</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="classgrppi_1_1context__t_html_ad53477882ee86ffd96faa2b3c2a91407"><div class="ttname"><a href="classgrppi_1_1context__t.html#ad53477882ee86ffd96faa2b3c2a91407">grppi::context_t::transformer</a></div><div class="ttdeci">Transformer &amp; transformer()</div><div class="ttdoc">Return the transformer function. </div><div class="ttdef"><b>Definition:</b> common/context.h:64</div></div>
<div class="ttc" id="namespacegrppi_html"><div class="ttname"><a href="namespacegrppi.html">grppi</a></div><div class="ttdef"><b>Definition:</b> callable_traits.h:26</div></div>
<div class="ttc" id="classgrppi_1_1context__t_html"><div class="ttname"><a href="classgrppi_1_1context__t.html">grppi::context_t</a></div><div class="ttdoc">Representation of a context pattern. Represents a context that uses a given policy to run a transform...</div><div class="ttdef"><b>Definition:</b> common/context.h:36</div></div>
<div class="ttc" id="classgrppi_1_1context__t_html_a1f38ffef80227917ab625a611556aaee"><div class="ttname"><a href="classgrppi_1_1context__t.html#a1f38ffef80227917ab625a611556aaee">grppi::context_t::transformer_type</a></div><div class="ttdeci">Transformer transformer_type</div><div class="ttdef"><b>Definition:</b> common/context.h:39</div></div>
<div class="ttc" id="classgrppi_1_1context__t_html_a12e3b41587de007b173d04fcf12529e6"><div class="ttname"><a href="classgrppi_1_1context__t.html#a12e3b41587de007b173d04fcf12529e6">grppi::context_t::execution_policy_type</a></div><div class="ttdeci">ExecutionPolicy execution_policy_type</div><div class="ttdef"><b>Definition:</b> common/context.h:40</div></div>
<div class="ttc" id="classgrppi_1_1context__t_html_a370f6d677c82a8088310bbf9eff654ab"><div class="ttname"><a href="classgrppi_1_1context__t.html#a370f6d677c82a8088310bbf9eff654ab">grppi::context_t::context_t</a></div><div class="ttdeci">context_t(ExecutionPolicy &amp;e, Transformer &amp;&amp;t) noexcept</div><div class="ttdoc">Constructs a context with a execution policy and a transformer. </div><div class="ttdef"><b>Definition:</b> common/context.h:47</div></div>
<div class="ttc" id="structgrppi_1_1internal_1_1is__context_html"><div class="ttname"><a href="structgrppi_1_1internal_1_1is__context.html">grppi::internal::is_context</a></div><div class="ttdef"><b>Definition:</b> common/context.h:84</div></div>
<div class="ttc" id="classgrppi_1_1context__t_html_a90fc787409776bca4dffcbf7cf660626"><div class="ttname"><a href="classgrppi_1_1context__t.html#a90fc787409776bca4dffcbf7cf660626">grppi::context_t::operator()</a></div><div class="ttdeci">auto operator()(I &amp;&amp;item) const </div><div class="ttdoc">Invokes the trasnformer of the context over a data item. </div><div class="ttdef"><b>Definition:</b> common/context.h:72</div></div>
<div class="ttc" id="classgrppi_1_1context__t_html_ac0731f745c4692b220cd717653f9f38e"><div class="ttname"><a href="classgrppi_1_1context__t.html#ac0731f745c4692b220cd717653f9f38e">grppi::context_t::execution_policy</a></div><div class="ttdeci">ExecutionPolicy &amp; execution_policy()</div><div class="ttdoc">Return the execution policy used in the context. </div><div class="ttdef"><b>Definition:</b> common/context.h:55</div></div>
<div class="ttc" id="namespacegrppi_html_ad4b58959f8008485515060fe1a37fb21"><div class="ttname"><a href="namespacegrppi.html#ad4b58959f8008485515060fe1a37fb21">grppi::requires_context</a></div><div class="ttdeci">typename std::enable_if_t&lt; is_context&lt; T &gt;, int &gt; requires_context</div><div class="ttdef"><b>Definition:</b> common/context.h:95</div></div>
<div class="ttc" id="namespacegrppi_html_ad3e99e81ed819576b5ee62e71144b77c"><div class="ttname"><a href="namespacegrppi.html#ad3e99e81ed819576b5ee62e71144b77c">grppi::is_context</a></div><div class="ttdeci">static constexpr bool is_context</div><div class="ttdef"><b>Definition:</b> common/context.h:92</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
